package com.hsh.erp.enums;

import com.hsh.erp.domain.dto.InOutTypeDTO;
import com.hsh.erp.domain.entity.InOutType;
import com.hsh.erp.utils.MyBeanUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 出入库类型枚举类
 */

public enum InOutTypeEnum {



    // 入库
    BUY_IN(101, 1, "采购入库"),
    TAKE_STOCK_IN(102, 1, "盘点入库"),
    OTHER_WAREHOUSE_IN(103, 1, "跨仓库借入"),
    RETURN_PRODUCT(104, 1, "退货入库"),


    // 出库
    SALE_OUT(201, 2, "销售出库"),
    TAKE_STOCK_OUT(202, 2, "盘点出库"),
    OTHER_WAREHOUSE_OUT(203, 2, "跨仓库借出"),
    UPDATE_ORDER_OUT(204, 2, "订单改动");

    /**
     * id
     */
    private final Integer id;

    /**
     * 1-入库 2-出库
     */
    private final Integer inOrOut;

    /**
     * 出入库类型名称
     */
    private final String name;

    public Integer getId() {
        return id;
    }

    public Integer getInOrOut() {
        return inOrOut;
    }

    public String getName() {
        return name;
    }

    InOutTypeEnum(int id, int inOrOut, String name) {
        this.id = id;
        this.inOrOut = inOrOut;
        this.name = name;

    }

    /**
     * 获得所有出库类型，并转为InOutType类型
     * @return
     */
    public static List<InOutType> getAll(){
        List<InOutTypeEnum> enumList = Arrays.stream(InOutTypeEnum.values())
                .collect(Collectors.toList());
        return MyBeanUtils.copyList(enumList, InOutType.class);
    }

}
